package com.xuecheng.orders.feignclient;

import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @author itcast
 */
@Slf4j
@Component
public class LearningServiceClientFallbackFactory implements FallbackFactory<LearningServiceClient> {
    @Override
    public LearningServiceClient create(Throwable throwable) {
        return new LearningServiceClient() {
            @Override
            public Boolean deleteChooseCourse(Long id) {
                log.error("删除课程记录发生熔断,选课记录id:{},熔断异常:{}", id, throwable.toString(), throwable);
                return false;
            }

            @Override
            public Boolean deleteCourseTable(Long chooseCourseId) {
                log.error("删除课表发生熔断,选课记录id:{},熔断异常:{}", chooseCourseId, throwable.toString(), throwable);
                return false;
            }
        };
    }
}
